﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="FormEditor.edit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>FormEditor.Demo-编辑页面</title>
    <script src="Scripts/ajaxhelper.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
    <script src="Scripts/formEditor.js" type="text/javascript"></script>
    <script>
        $(document).ready(function () {
            ajaxmethod('Handler/UsersHandler.ashx?actiontype=getnations', function (data) {
                var $obj = JSON.parse(data);
                $("select[datakey]").each(function () {
                    $this = $(this);
                    var str = "";
                    for (var i = 0; i < $obj.length; i++) {
                        $objson = $obj[i];
                        str += "<option value='" + $objson["Code"] + "'>" + $objson["Name"] + "</option>";
                    }
                    $this.append(str);
                });
                ajaxmethod("Handler/UsersHandler.ashx?actiontype=getusers", function (data) {
                    //通过插件方法赋值-参数为json对象
                    $(".formeditor").setValues(data);

                });
            });
            //通过插件方法取值-获得的结果为json对象
            getValues();
        });
        function getValues() {
            return alert($(".formeditor").getValues());
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        用户名2：<input id="Text8" type="text" datakey="Name2" />
        <div class="formeditor">
            用户名：<input id="Text1" type="text" datakey="Name" /><br />
            <br />
            &nbsp; 密码：<input id="Text2" type="text" datakey="Pass" /><br />
            <br />
            &nbsp; 邮箱：<input id="Text3" type="text" datakey="Email" /><br />
            <br />
            &nbsp; 启用：<input id="Text4" type="checkbox" datakey="IsUse" /><br />
            <br />
            &nbsp; 手机：<input id="Text5" type="text" datakey="Phone" /><br />
            <br />
            &nbsp; Q  Q：<input id="Text6" type="text" datakey="QQ" /><br />
            <br />
            &nbsp; 地址：<input id="Text7" type="text" datakey="Address" /><br />
            <br />
            &nbsp; 民族：<select id="sel1" datakey="NationType"></select><br />
            <br />
            &nbsp; 性别：<input id="Radio1" type="radio" datakey="Sex" value="男" name="rdoSex" />男
            <input id="Radio2" type="radio" datakey="Sex" value="女" name="rdoSex" />女<br />
            <br />
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;
        <input id="btnSave" type="button" value="保存" /><br />
        </div>
    </form>
</body>
</html>
